<?php
class Project extends AppModel {
	var $name = 'Project';
	var $alias = 'Project';

	/*var $belongsTo = array(
		'TypeUser' => array(
			'className'  	=> 'TypeUser',
			'foreignKey'    => 'type_user_id',
			'conditions'	=> '',
			'fields'		=> ''
			)
	);

	var $validate = array(
      	'userName' => array (
			'notEmpty' => array (
				'rule'=>'notEmpty',
				'message' => 'User name should not be blank.'
			),
			'isUnique' => array (
				'rule'=>'isUnique',
				'message' => 'This user is already in the system.'
			)
		),
		'password' => array (
			'notEmpty' => array (
				'rule'=>'notEmpty',
				'message' => 'Password should not be blank.'
			),
		),
		'confirmedPassword' => array (
			'notEmpty' => array (
				'rule'=>'notEmpty',
				'message' => 'Confirmed password should not be blank.'
			),
			'matchPasswords' => array (
				'rule'=>'matchPasswords',
				'message' => 'Confirmed password is not matched'
			),
		),
		
		'captcha' => array (
			'captcha' => array (
				'rule'=>'validateCaptcha',
				'message' => 'Captcha is not matched.'
			),
		),
    );
         	
	function emptyUpdate() {
        if (!empty($this->data['User']['password']) && empty($this->data['User']['confirmPassword'])) {
         	return false;
        } else {
         	return true;
        }
	}
	
	function matchPasswords() {
		if ($this->data['User']['password'] != $this->data['User']['confirmedPassword']) {
        	return false;
        } else {
        	return true;
        }
    }
    
	function validateCaptcha() {
		//		$name = $this->controller->name;
		//		if(isset($params['name'])){
		//			$name = $params['name'];
		//		}
		
		if (!defined('captcha'))
		define('captcha', 'kcaptcha');
		if (!empty ($_SESSION['captcha']) && $this->data['User']['captcha'] == $_SESSION['captcha']) {
			// clear to prevent re-use
			unset ($_SESSION['captcha']);
			return true;
		}
		return false;
	}*/

}
?>